<% mongrel_servers.times do |counter| -%>
  check process mongrel-<%=mongrel_port+counter%> with pidfile <%= mongrel_pid_dir %>/mongrel.<%=mongrel_port+counter%>.pid
	group mongrel_<%= application %>
	start program = "/usr/local/bin/ruby /usr/local/bin/mongrel_rails cluster::start --clean -C <%= mongrel_conf %> --only <%=mongrel_port+counter%>"
	stop program = "/usr/local/bin/ruby /usr/local/bin/mongrel_rails cluster::stop -C <%= mongrel_conf %> --only <%=mongrel_port+counter%>"
		
	if failed host 127.0.0.1 port <%=mongrel_port+counter%> protocol http
    	with timeout 10 seconds
    	then alert

	if totalmem > 100 Mb then restart
	if cpu > 60% for 2 cycles then alert
	if cpu > 80% for 5 cycles then restart
	if loadavg(5min) > 10 for 8 cycles then restart
	if 3 restarts within 5 cycles then timeout

<% end -%>
